<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>图片选择</title>
 
</head>
<body>
  <div>
    <img style="height: 400px;width: 400px;position: relative;left: 25px;" src="./assets/300.jpg" alt="" class="big">
  </div>
  <div class="small">
    <img src="./assets/301.jpg" alt="">
    <img src="./assets/302.jpg" alt="">
    <img src="./assets/303.jpg" alt="">
    <img src="./assets/304.jpg" alt="">
  </div> 
  <script>
    // 逻辑：本质上把小图的src赋值给大图的src
    // 图片元素。src=''
    let imgs = document.getElementsByTagName('img');
    for(let i =1;i<imgs.length;i++){
      imgs[i].onmouseover = function(){
        // 把当前小图的src给到大图 的src
        imgs[0].src = this.src;
      }
    }
  </script>
</body>
<style>
  img{
    height: 100px;
    width: 100px;
    margin: 5px;
  }
</style>
</html>